package com.jzj.jzjctripapi.controller;

import com.jzj.jzjctripapi.domain.entity.Personinfo;
import com.jzj.jzjctripapi.domain.request.AuthenticationListRequst;
import com.jzj.jzjctripapi.domain.response.AuthenticationInfoListResponse;
import com.jzj.jzjctripapi.service.impl.PersoninfoServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Mazhenming
 * @date 2023/11/6 20:27
 * @desciption: 人员信息
 */

@RestController
public class PersoninfoController {
    @Autowired
    private PersoninfoServiceImpl personinfoService;

    @GetMapping("/index")
    public AuthenticationListRequst selectAll(){
        List<Personinfo> personinfoList = personinfoService.selectAll();
        return personinfoService.buildAuthenticationListRequst(personinfoList,"testTicket");
    }

    /**
     * 获取所有人员信息
     */
//    @GetMapping("/ticket")
//    public AuthenticationListRequst getEmployeeSyncTicket(){
//       return personinfoService.buildAuthenticationListRequst("testTick");
//    }

    /**
     * 发送人员信息
     *
     * @return
     */
    @GetMapping("/SaveCorpCustInfoList")
    public void getEmployeeSyncTicket() {
        System.out.println("数据启动成功");
        personinfoService.sendDataToThirdParty();
    }

    /**
     * 更新单人数据
     */
    @GetMapping("/SaveCorpCustInfoListOnce")
    public void getEmployeeSyncTicketOnce() {
        System.out.println("数据启动成功");
        personinfoService.sendDataToThirdPartyOnce();
    }

    /**
     * 更新单人数据
     */
    @GetMapping("/SaveCorpCustInfoListAll")
    public void getEmployeeSyncTicketAll() throws InterruptedException {
        System.out.println("数据启动成功");
        personinfoService.sendDataToThirdPartyAll();
    }




}
